# Copyright 2022 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//pw_bloat:pw_cc_size_binary.bzl", "pw_cc_size_binary")

package(default_visibility = ["//visibility:public"])

cc_library(
    name = "size_report",
    hdrs = [
        "public/pw_containers/size_report/dynamic_deque.h",
        "public/pw_containers/size_report/size_report.h",
    ],
    strip_include_prefix = "public",
    deps = [
        "//pw_allocator:libc_allocator",
        "//pw_bloat:bloat_this_binary",
    ],
)

cc_library(
    name = "flat_map",
    hdrs = ["public/pw_containers/size_report/flat_map.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:flat_map",
    ],
)

cc_library(
    name = "deque",
    hdrs = ["public/pw_containers/size_report/deque.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:inline_deque",
    ],
)

cc_library(
    name = "inline_queue",
    hdrs = ["public/pw_containers/size_report/inline_queue.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:inline_queue",
    ],
)

cc_library(
    name = "intrusive_forward_list",
    hdrs = ["public/pw_containers/size_report/intrusive_forward_list.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_forward_list",
    ],
)

cc_library(
    name = "intrusive_list",
    hdrs = ["public/pw_containers/size_report/intrusive_list.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_list",
    ],
)

cc_library(
    name = "intrusive_map",
    hdrs = ["public/pw_containers/size_report/intrusive_map.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_map",
    ],
)

cc_library(
    name = "intrusive_multimap",
    hdrs = ["public/pw_containers/size_report/intrusive_multimap.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_multimap",
    ],
)

cc_library(
    name = "intrusive_multiset",
    hdrs = ["public/pw_containers/size_report/intrusive_multiset.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_multiset",
    ],
)

cc_library(
    name = "intrusive_set",
    hdrs = ["public/pw_containers/size_report/intrusive_set.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:intrusive_set",
    ],
)

cc_library(
    name = "vector",
    hdrs = ["public/pw_containers/size_report/vector.h"],
    features = ["-conversion_warnings"],
    strip_include_prefix = "public",
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:vector",
    ],
)

pw_cc_size_binary(
    name = "base",
    srcs = ["base.cc"],
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "flat_map_base",
    srcs = ["flat_map.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":flat_map",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "flat_map_alternate_types",
    srcs = ["flat_map.cc"],
    defines = [
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_KEY",
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE",
    ],
    features = ["-conversion_warnings"],
    deps = [
        ":flat_map",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "fixed_deque_dynamic_base",
    srcs = ["fixed_deque_dynamic.cc"],
    deps = [
        ":deque",
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:deque",
    ],
)

pw_cc_size_binary(
    name = "fixed_deque_dynamic_alternate_type",
    srcs = ["fixed_deque_dynamic.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    deps = [
        ":deque",
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:deque",
    ],
)

pw_cc_size_binary(
    name = "fixed_deque_static_base",
    srcs = ["fixed_deque.cc"],
    deps = [
        ":deque",
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:deque",
    ],
)

pw_cc_size_binary(
    name = "fixed_deque_static_alternate_type",
    srcs = ["fixed_deque.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    deps = [
        ":deque",
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:deque",
    ],
)

pw_cc_size_binary(
    name = "fixed_deque_static_and_dynamic",
    srcs = ["fixed_deque_static_and_dynamic.cc"],
    deps = [
        ":deque",
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:deque",
    ],
)

pw_cc_size_binary(
    name = "dynamic_deque_base",
    srcs = ["dynamic_deque.cc"],
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:dynamic_deque",
    ],
)

pw_cc_size_binary(
    name = "dynamic_deque_alternate_type",
    srcs = ["dynamic_deque.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:dynamic_deque",
    ],
)

pw_cc_size_binary(
    name = "std_deque_base",
    srcs = ["std_deque.cc"],
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "std_deque_alternate_type",
    srcs = ["std_deque.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    deps = [
        ":size_report",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "inline_deque_base",
    srcs = ["inline_deque.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":deque",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:inline_deque",
    ],
)

pw_cc_size_binary(
    name = "inline_deque_alternate_type",
    srcs = ["inline_deque.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":deque",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:inline_deque",
    ],
)

pw_cc_size_binary(
    name = "inline_queue_base",
    srcs = ["inline_queue.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":inline_queue",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "inline_queue_alternate_type",
    srcs = ["inline_queue.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":inline_queue",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "inline_deque_and_queue",
    srcs = ["inline_deque_and_queue.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":deque",
        ":inline_queue",
        "//pw_bloat:bloat_this_binary",
        "//pw_containers:inline_deque",
    ],
)

pw_cc_size_binary(
    name = "intrusive_forward_list_base",
    srcs = ["intrusive_forward_list.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_forward_list",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_forward_list_alternate_type",
    srcs = ["intrusive_forward_list.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_forward_list",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_list_base",
    srcs = ["intrusive_list.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_list",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_list_alternate_type",
    srcs = ["intrusive_list.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_list",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_list_and_forward_list",
    srcs = ["intrusive_list_and_forward_list.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_forward_list",
        ":intrusive_list",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_map_base",
    srcs = ["intrusive_map.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_map",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_map_alternate_key",
    srcs = ["intrusive_map.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_KEY"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_map",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_map_alternate_types",
    srcs = ["intrusive_map.cc"],
    defines = [
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_KEY",
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE",
    ],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_map",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_multimap_base",
    srcs = ["intrusive_multimap.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multimap",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_multimap_alternate_key",
    srcs = ["intrusive_multimap.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_KEY"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multimap",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_multimap_alternate_types",
    srcs = ["intrusive_multimap.cc"],
    defines = [
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_KEY",
        "PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE",
    ],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multimap",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_map_and_multimap",
    srcs = ["intrusive_map_and_multimap.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_map",
        ":intrusive_multimap",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_set_base",
    srcs = ["intrusive_set.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_set",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_set_alternate_type",
    srcs = ["intrusive_set.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_set",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_multiset_base",
    srcs = ["intrusive_multiset.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multiset",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_multiset_alternate_type",
    srcs = ["intrusive_multiset.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multiset",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "intrusive_set_and_multiset",
    srcs = ["intrusive_set_and_multiset.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":intrusive_multiset",
        ":intrusive_set",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "vector_base",
    srcs = ["vector.cc"],
    features = ["-conversion_warnings"],
    deps = [
        ":vector",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "vector_alternate_size",
    srcs = ["vector.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_SIZE"],
    features = ["-conversion_warnings"],
    deps = [
        ":vector",
        "//pw_bloat:bloat_this_binary",
    ],
)

pw_cc_size_binary(
    name = "vector_alternate_type",
    srcs = ["vector.cc"],
    defines = ["PW_CONTAINERS_SIZE_REPORT_ALTERNATE_VALUE"],
    features = ["-conversion_warnings"],
    deps = [
        ":vector",
        "//pw_bloat:bloat_this_binary",
    ],
)
